package com.example.backend.service.mysql.order.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.backend.dto.request.PageUserDto;
import com.example.backend.entitly.mysql.user.Carts;
import com.example.backend.mapper.mysql.order.CartsMapper;
import com.example.backend.service.mysql.order.CartsService;
import org.springframework.stereotype.Service;

/**
 * @author 1
 * @description 针对表【carts(购物车表)】的数据库操作Service实现
 * @createDate 2025-06-04 09:01:51
 */
@Service
public class CartsServiceImpl extends ServiceImpl<CartsMapper, Carts>
        implements CartsService {

    @Override
    public Page<Carts> listByCart(PageUserDto user) {
        Page<Carts> objectPage = new Page<>(user.getPageNum(), user.getPageSize());
        return new LambdaQueryChainWrapper<>(getBaseMapper())
                .eq(Carts::getUserId, user)
                .page(objectPage);
    }
}




